<!--停开申请-->
<template>
  <div class="gas-apply-for-box">
    <PageTitle class="boxTitle" :text="title"></PageTitle>
    <!-- <div class="date-tips">2023-07-04 11:26 发表于重庆</div> -->
    <div class="con-box detailContent">
      <!-- <div class="primary-tit title">请仔细阅读后申请安装</div>
      <b class="b">1、工商户申请用气，需安排工作人员上门查看。</b>
      <b class="b">2、业务员现场勘查后方可确定是否符合安装条件。</b>
      <b class="b">3、请认真填写完整的信息，以便工作人员能更快更准确为您办理您的报装。</b>
      <b class="b">4、在用气报装过程中，用户不需支付任何费用。</b>
      <b class="b">5、工商用户完成燃气报装后，将指定专人一对一负责跟踪、指导做好用气环境安全措施，采取简化手续、优化流程等“管家式”服务。</b> -->
      <p class="p">已点火通气用户申请恢复供气情况</p>
      <div class="primary-tit title">申请信息</div>
      <div>
        <tui-form ref="form">
          <tui-input label="用户编号" :required="true" :lineLeft="false" placeholder="请输入编号" v-model="formData.number"></tui-input>
          <tui-input label="用户姓名" :required="true" :lineLeft="false" placeholder="请输入用户姓名" v-model="formData.name"></tui-input>
          <!-- <tui-input label="地址" :required="true" :lineLeft="false" placeholder="请输入地址" v-model="formData.address"></tui-input> -->
          <tui-input label="联系电话" :required="true" :lineLeft="false" type="number" placeholder="请输入联系电话" v-model="formData.phone" maxlength="11"></tui-input>
          <tui-textarea label="详细说明" :borderTop="false" placeholder="请输入详细说明" v-model="formData.content"></tui-textarea>
          <view class="tui-btn__box">
            <tui-button height="84rpx" @click="submit" :disabled="loading" :loading="loading">提交</tui-button>
          </view>
        </tui-form>
      </div>
    </div>
    <!-- <div class="con-box tips">
      <div class="warning-tit title">温馨提示</div>
      <div>初一年级是学生由小学进入中学的入门阶段。初中写作要求学生具备较强的文字运用能力。下面小编为大家带来初一的初一作文优秀范文大全800字6篇，希望对大家的写作有帮助</div>
    </div> -->

    <FooterTel></FooterTel>
  </div>
</template>

<script>
import PageTitle from '../components/pageTitle.vue'
import FooterTel from '../components/footerTel.vue'
const rules = [{
  name: "number",
  rule: ["required"],
  msg: ["请输入用户编号"]
}, {
  name: "name",
  rule: ["required"],
  msg: ["请输入姓名"]
}, {
  name: "phone",
  rule: ["required", "isMobile"],
  msg: ["请输入手机号", "请输入正确的手机号"]
}];
export default {
  name: 'Detail',
  components: {
    PageTitle,
    FooterTel
  },
  data () {
    return {
      title: null,
      // openid: 'oi8TY6O8cwzuaSky6VNq214MHjVs',
      formData: {
        openid: '',
        number: '',
        name: '',
        // address: '',
        phone: '',
        content: '',
      },
      rules: rules,
      loading: false,
      openId: null,
    };
  },
  async onShow () {

  },
  async onLoad (e) {
    var vm = this;
    vm.title = e.title
  },
  created () {
  },
  methods: {
    submit () {
      var vm = this;
      vm.getId()
      if (!vm.$refs.form) return;
      vm.$refs.form.validate(vm.formData, vm.rules).then(res => {
        vm.formData.openid = vm.openId
        vm.loading = true
        vm.tui.request('/api/gasstop/add', 'post', vm.formData, false, false, true).then((res) => {
          if (res.code == 200) {
            uni.showToast({
              icon: "success",
              title: '添加成功'
            });
            setTimeout(() => {
              vm.formData = {}
              uni.redirectTo({
                url: '/pages/index/index'
              });
              vm.loading = false
            }, 500);
          }
        }).catch((e) => { })
      }).catch(errors => {
        console.log(errors)
      })
    },
    getId () {
      var vm = this;
      vm.openId = uni.getStorageSync('openId')
      // 没有openId跳转获取code页面
      if (!vm.openId) return vm.func.goto('/pages/getCode/index')
    }
  },
  mounted () {
    var vm = this;
    vm.getId()
  },
};
</script>

<style lang="scss" scoped>
@import "../../static/css/module.scss";
.gas-apply-for-box {
  padding-bottom: 20px;
  .boxTitle {
    margin: 10px 14px;
  }
  .detailContent,
  .tips {
    p.p {
      padding: 20px 0 8px;
    }
    padding: 0 18px 20px;
    margin: 14px;
    font-size: 15px;
    line-height: 22px;
    overflow: hidden;
    .title {
      width: 100%;
      height: 30px;
      padding-left: 14px;
      line-height: 30px;
      font-size: 17px;
      font-weight: bold;
      color: #222;
      box-sizing: border-box;
      margin: 10px 0;
    }
    :v-deep .tui-textarea__wrap,
    :v-deep .tui-input__wrap {
      padding: 12px 0 12px 8px !important;
    }
    :v-deep .tui-placeholder,
    :v-deep .tui-textarea__label,
    :v-deep .tui-textarea__self,
    :v-deep .uni-input-placeholder,
    :v-deep .tui-input__label,
    :v-deep.tui-input__self {
      font-size: 15px !important;
      uni-text,
      text {
        font-size: 15px !important;
      }
    }
    :v-deep.tui-textarea__wrap {
      align-items: flex-start !important;
    }
    :v-deep .tui-input__required {
      left: 0;
      top: 45%;
    }
    .tui-btn__box {
      padding-top: 30px;
    }
  }
  :v-deep .tui-form__errmsg {
    left: 14px;
    right: 14px;
  }
}
</style>
